/*MyPhotoIndex Free Photo Organizer <www.myphotoindex.com>
  Copyright (C) <2006-2009>  <Asaf Yarkoni asaf@yarkoni.net>

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.*/
using System;
using System.Collections.Generic;
using System.Text;
using MyPhotoIndex.Interfaces.Plugins;
using MyPhotoIndex.Plugins;
using System.Collections.ObjectModel;
using System.Drawing;

namespace MyPhotoIndex
{
    class RandomSlideShowEffect : ISlideShowEffectPlugin
    {
        #region ISlideShowEffectPlugin Members

        public System.Drawing.Image Icon
        {
            get { return null; }
        }

        public void Transform(Graphics graphics, Rectangle drawingBounds, Image oldImage, Image newImage, Rectangle oldBounds, Rectangle newBounds)
        {
            ReadOnlyCollection<ISlideShowEffectPlugin> plugins = Manager.GetPlugins<ISlideShowEffectPlugin>();
            if (plugins.Count > 0)
            {
                Random random = new Random();
                int idx = random.Next(plugins.Count);
                plugins[idx].Transform(graphics, drawingBounds, oldImage, newImage, oldBounds, newBounds);
            }
        }

        #endregion

        #region IPlugin Members

        public bool Load(MyPhotoIndex.Interfaces.IApplicationContext applicationContext)
        {
            return false;
        }

        public string Name
        {
            get { return Resources.Resources.SlideShowEffect_Reandom; }
        }

        public string Description
        {
            get { return Resources.Resources.SlideShowEffect_Reandom; }
        }

        public void Unload()
        {
            
        }

        #endregion

        public override string ToString()
        {
            return Name;
        }
    }
}
